package dz.chuxin.app.sample;

import android.content.Intent;
import android.os.Bundle;

import java.util.concurrent.TimeUnit;

import dz.chuxin.app.R;
import dz.chuxin.app.core.AppStatusTracker;
import dz.chuxin.app.core.BaseActivity;
import dz.chuxin.app.core.ConstantValues;
import rx.Observable;
import rx.functions.Action1;

/**
 * App启动欢迎界面
 * Created by chuxin on 2016/6/30.
 */
public class WelcomeActivity extends BaseActivity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        AppStatusTracker.getInstance().setAppStatus(ConstantValues.APP_STATUS_OFFLINE);
        super.onCreate(savedInstanceState);
    }

    @Override
    protected void setUpContentView() {
        setContentView(R.layout.activity_welcome);
    }

    @Override
    protected void setUpData(Bundle savedInstanceState) {
        super.setUpData(savedInstanceState);
        Observable.timer(2, TimeUnit.SECONDS).subscribe(new Action1<Long>() {
            @Override
            public void call(Long aLong) {
                startActivity(new Intent(WelcomeActivity.this, HomeActivity.class));
                finish();
            }
        });
    }
}
